package ccnu.agile.service;

import ccnu.agile.bean.request.FileRequest;
import ccnu.agile.bean.response.Response;
import ccnu.agile.constant.Business;

/**
 * 对象存储服务接口
 */
public interface IFOSService {

    /**
     * 文件上传
     *
     * @param request
     * @return
     */
    Response upload(FileRequest request);

    /**
     * 存储文件名
     *
     * @param fileRequest
     * @return
     */
    default String getSaveFileName(FileRequest fileRequest) {
        return new StringBuilder(fileRequest.getBusiness().getBusiessName())
                .append(Business.SymbolStr.UNDERLINE)
                .append(fileRequest.getFile().getOriginalFilename())
                .toString();
    }
}
